﻿CREATE view [dbo].[VersionDistributionYesterday] as 

select (case when VersionStr is null then 'unknown' else VersionStr end)+' (#'+cast(ReleaseId as varchar(20))+')' as VersionStr,CheckCount,cast(CheckCount as float)/(select sum(CheckCount) from UpdateCheckDW b where a.CheckDay=b.CheckDay) as [Percent]
from UpdateCheckDW a
left outer join Releases
on a.ReleaseId=Releases.Id
where CheckDay=(convert(varchar(50),dbo.LastDwUpdate()-1,112))
and PublicReleased<>0
